<html>
<head><meta charset="utf-8"><title>I-prioritize #78747 unused_parens false positive on braced … · t-compiler/wg-prioritization/alerts · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/index.html">t-compiler/wg-prioritization/alerts</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html">I-prioritize #78747 unused_parens false positive on braced …</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="215641972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215641972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215641972">(Nov 04 2020 at 21:12)</a>:</h4>
<p><span class="user-group-mention" data-user-group-id="3111">@WG-prioritization/alerts</span> issue <a href="https://github.com/rust-lang/rust/issues/78747">#78747</a> has been requested for prioritization.</p>
<h1><a href="https://forge.rust-lang.org/compiler/prioritization/procedure.html#assign-priority-to-unprioritized-issues-with-i-prioritize-label">Procedure</a></h1>
<ul>
<li>Priority?</li>
<li>Regression?</li>
<li>Notify people/groups?</li>
<li>Needs <code>I-nominated</code>?</li>
</ul>



<a name="215642061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215642061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215642061">(Nov 04 2020 at 21:13)</a>:</h4>
<p>P-medium I think - if we didn't count P-low as effectively 'wontfix' I'd say p-low</p>



<a name="215642261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215642261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215642261">(Nov 04 2020 at 21:15)</a>:</h4>
<p>That's weird: why are parens required here?</p>



<a name="215642300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215642300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215642300">(Nov 04 2020 at 21:15)</a>:</h4>
<p>The code is:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">macro_rules</span><span class="o">!</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">{}</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s">"q"</span><span class="w"> </span><span class="p">};</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">f</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nb">String</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">(</span><span class="n">x</span><span class="o">!</span><span class="w"> </span><span class="p">{}.</span><span class="n">to_string</span><span class="p">())</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>



<a name="215642343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215642343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215642343">(Nov 04 2020 at 21:16)</a>:</h4>
<p>I would understand if having parens around <code>x! {}</code> was required, but how does surrounding the entire expression help?</p>



<a name="215642491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215642491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215642491">(Nov 04 2020 at 21:16)</a>:</h4>
<p>Seems like weird parser behavior</p>



<a name="215691113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215691113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> apiraino <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215691113">(Nov 05 2020 at 10:03)</a>:</h4>
<p>I'm ok with a <code>P-low</code> if the implications are not impacting (I cant tell at a glance). <span class="user-mention" data-user-id="232545">@Joshua Nelson</span> also curious about the wontfix  suggestion: is it because of the strange syntax that triggers the warning, right?</p>



<a name="215691780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215691780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215691780">(Nov 05 2020 at 10:10)</a>:</h4>
<p>parens are required  because by using them we are in an expression context or however it's called</p>



<a name="215691808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215691808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215691808">(Nov 05 2020 at 10:10)</a>:</h4>
<p>without parens we parse <code>x! {}</code> as a statement</p>



<a name="215691839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215691839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215691839">(Nov 05 2020 at 10:11)</a>:</h4>
<p>allowing for</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">test</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">usize</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="o">!</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">    </span><span class="mi">4</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="215692015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215692015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215692015">(Nov 05 2020 at 10:12)</a>:</h4>
<p>I think <code>P-medium</code> is good here as we shouldn't emit incorrect lints</p>



<a name="215692149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215692149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215692149">(Nov 05 2020 at 10:14)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/245100-t-compiler.2Fwg-prioritization.2Falerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6/near/215691780">said</a>:</p>
<blockquote>
<p>parens are required  because by using them we are in an expression context or however it's called</p>
</blockquote>
<p>This is the reason that</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">if</span><span class="w"> </span><span class="n">cond</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">value</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">other_value</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">3</span><span class="w"></span>
</code></pre></div>
<p>fails to compile<br>
but the following works</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">cond</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">value</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">other_value</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">3</span><span class="w"></span>
</code></pre></div>



<a name="215692903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215692903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> apiraino <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215692903">(Nov 05 2020 at 10:22)</a>:</h4>
<p>wow thanks <span class="user-mention" data-user-id="216206">@lcnr</span> interesting <span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span></p>



<a name="215692930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215692930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> apiraino <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215692930">(Nov 05 2020 at 10:22)</a>:</h4>
<p><code>P-medium</code> then</p>



<a name="215693002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215693002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215693002">(Nov 05 2020 at 10:23)</a>:</h4>
<p>Issue <a href="https://github.com/rust-lang/rust/issues/78747">#78747</a>'s prioritization request has been removed.</p>



<a name="215739412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215739412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215739412">(Nov 05 2020 at 16:43)</a>:</h4>
<p><span class="user-mention silent" data-user-id="250987">apiraino</span> <a href="#narrow/stream/245100-t-compiler.2Fwg-prioritization.2Falerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6/near/215691113">said</a>:</p>
<blockquote>
<p>I'm ok with a <code>P-low</code> if the implications are not impacting (I cant tell at a glance). <span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> also curious about the wontfix  suggestion: is it because of the strange syntax that triggers the warning, right?</p>
</blockquote>
<p>no, I'm saying I'd like to put it between p-medium and 'wontfix'</p>



<a name="215739444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215739444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215739444">(Nov 05 2020 at 16:43)</a>:</h4>
<p>and in the past people have said that p-low is effectively the same as 'wontfix'</p>



<a name="215765470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize%20%2378747%20unused_parens%20false%20positive%20on%20braced%20%E2%80%A6/near/215765470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/245100-t-compiler/wg-prioritization/alerts/topic/I-prioritize.20.2378747.20unused_parens.20false.20positive.20on.20braced.20.E2.80.A6.html#215765470">(Nov 05 2020 at 19:53)</a>:</h4>
<p>Thanks <span class="user-mention silent" data-user-id="216206">lcnr</span> by the way for the explanation!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>